package com.shixun.dds_11.mapper;

import com.github.pagehelper.Page;
import com.shixun.dds_11.dto.AddressPageQueryDTO;
import com.shixun.dds_11.entity.DdsAddress;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.shixun.dds_11.entity.DdsOrder;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author LH
 * @since 2024-07-05
 */

@Mapper
public interface DdsAddressMapper extends BaseMapper<DdsAddress> {
    int insertSelective(DdsAddress ddsAddress);

    @Delete("delete from dds_address where id = #{id}")
    int deleteById(Integer id);

    @Delete("delete from dds_address where user_id = #{userId}")
    int deleteByUserId(Integer userId);

    int updateByPrimaryKeySelective(DdsAddress ddsAddress);

    @Select("select * from dds_address where user_id = #{userId}")
    List<DdsAddress> findAllByUserId(Integer userId);

    @Select("select * from dds_address where user_id = #{id}")
    DdsAddress findAllById(Integer id);

    Page<DdsAddress> pageQuery(AddressPageQueryDTO addressPageQueryDTO);
}
